import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

export default ({ mode }) => defineConfig({
  base: './',
  plugins: [
    vue()
  ],
  server: {
    host: '0.0.0.0',
    proxy: {
      '/manage': loadEnv(mode, './').VITE_HOST,
      '/erp': loadEnv(mode, './').VITE_HOST,
      '/store': loadEnv(mode, './').VITE_HOST,
      '/provider': loadEnv(mode, './').VITE_HOST,
    }
  },
  resolve: {
    alias: [{ 
      find: '@', 
      replacement: resolve(__dirname, 'src') 
    }]
  }
})